home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 February / Ahoy_Magazine_86-02_1986_Double_L.d64 / making change 3 (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  305b  |  10 lines

  1. 0 rem << cd26-1c >>
  2. 1 rem  commodare #22-1 :
  3. 2 rem         making change
  4. 3 rem  solution  by  b. zidovec
  5. 4 rem
  6. 10 input"amount $";a:a=a*100:input"# of coins";c:print:print" q d n p":print
  7. 20 forq=0toa/25:ford=0toa/10:forn=0toa/5:forp=0toa:ifq+d+n+p<>cthen40
  8. 30 if 25*q+10*d+5*n+p=a then printq;d;n;p:f=1
  9. 40 next p,n,d,q:if f=0 then print"no solution"
  10.